Link rel=modulepreload: Add comments that map code to the spec This patch also fixes the followings: - Reject modulepreloads with invalid as="" value - ParserState should be "not parser inserted" Bug: 740886 Change-Id: I9f3c8e87da31a0b09bad208d681e200b6a06d69e Reviewed-on: https://chromium-review.googlesource.com/768773 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#516974} diff --git a/preload/modulepreload.html b/preload/modulepreload.html index 160b37a..5b70bc8 100644 --- a/preload/modulepreload.html +++ b/preload/modulepreload.html
@@ -88,5 +88,21 @@ return attachAndWaitForError(link); }, 'link rel=modulepreload with bad href attribute'); +promise_test(function(t) { + var link = document.createElement('link'); + link.rel = 'modulepreload'; + link.href = 'resources/module1.js?as-script'; + link.as = 'script' + return attachAndWaitForLoad(link); +}, 'link rel=modulepreload as=script'); + +promise_test(function(t) { + var link = document.createElement('link'); + link.rel = 'modulepreload'; + link.href = 'resources/module1.js?as-image'; + link.as = 'image' + return attachAndWaitForError(link); +}, 'link rel=modulepreload with invalid as= value'); + </script> </body>